Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 29afadd13ee27f0aac019d8612f10696bb43dc46


Parents : 637fd52
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Signature : T66BB85Valid, signed by author
Date : 2026-07-21T16:54:10+02:00

Cleanup

Changes

1 files changed, 54 insertions(+), 160 deletions(-)


Diff

diff --git a/sbapp/ui/objectdetails.py b/sbapp/ui/objectdetails.py
index 7fc9a01c..a4728129 100644
--- a/sbapp/ui/objectdetails.py
+++ b/sbapp/ui/objectdetails.py
@@ -568,39 +568,25 @@ class RVDetails(MDRecycleView):
if via != None:
vstr = self.app.sideband.peer_display_name(via)
via_str = f"Received from [b]{vstr}[/b]"
- else:
- via_str = "Received from an [b]unknown peer[/b]"
-
+ else: via_str = "Received from an [b]unknown peer[/b]"
if by != None:
dstr = self.app.sideband.peer_display_name(by)
by_str = f", collected by [b]{dstr}[/b]"
- else:
- by_str = f", collected by an [b]unknown peer[/b]"
-
+ else: by_str = f", collected by an [b]unknown peer[/b]"
formatted_values = f"{via_str}{by_str}"
- if formatted_values == "":
- formatted_values = None
-
+ if formatted_values == "": formatted_values = None
if not by == self.app.sideband.lxmf_destination.hash and not self.app.sideband.is_trusted(by):
extra_entries.append({"icon": "alert", "text": "Collected by a [b]non-trusted[/b] peer", "on_release": pass_job})
-
release_function = pass_job
elif name == "Battery":
- p = s["values"]["percent"]
- cs = s["values"]["_meta"]
- t = None
- if "temperature" in s["values"]:
- t = s["values"]["temperature"]
+ p = s["values"]["percent"]; cs = s["values"]["_meta"]; t = None
+ if "temperature" in s["values"]: t = s["values"]["temperature"]
if cs != None:
- if t != None:
- cs_str = f" ({cs}, {t}° C)"
- else:
- cs_str = f" ({cs})"
-
+ if t != None: cs_str = f" ({cs}, {t}° C)"
+ else: cs_str = f" ({cs})"
if p != None: formatted_values = f"{name} [b]{p}%[/b]"+cs_str
-
release_function = pass_job
elif name == "Ambient Pressure":
@@ -610,7 +596,6 @@ class RVDetails(MDRecycleView):
if "deltas" in s and dt in s["deltas"] and s["deltas"][dt] != None:
d = s["deltas"][dt]
formatted_values += f" (Δ = {d} mbar)"
-
release_function = pass_job
elif name == "Ambient Temperature":
@@ -620,7 +605,6 @@ class RVDetails(MDRecycleView):
if "deltas" in s and dt in s["deltas"] and s["deltas"][dt] != None:
d = s["deltas"][dt]
formatted_values += f" (Δ = {d}° C)"
-
release_function = pass_job
elif name == "Relative Humidity":
@@ -630,7 +614,6 @@ class RVDetails(MDRecycleView):
if "deltas" in s and dt in s["deltas"] and s["deltas"][dt] != None:
d = s["deltas"][dt]
formatted_values += f" (Δ = {d}%)"
-
release_function = pass_job
elif name == "Physical Link":
@@ -646,47 +629,24 @@ class RVDetails(MDRecycleView):
if q != None or rssi != None: snr_str = ", "+snr_str
if q_str or rssi_str or snr_str:
formatted_values = q_str+rssi_str+snr_str
-
release_function = pass_job
elif name == "Power Consumption":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cicon = c["custom_icon"]
- watts = c["w"]
- prefix = ""
- if watts < 1/1e6:
- watts *= 1e9
- prefix = "n"
- elif watts < 1/1e3:
- watts *= 1e6
- prefix = "µ"
- elif watts < 1:
- watts *= 1e3
- prefix = "m"
- elif watts >= 1e15:
- watts /= 1e15
- prefix = "E"
- elif watts >= 1e12:
- watts /= 1e12
- prefix = "T"
- elif watts >= 1e9:
- watts /= 1e9
- prefix = "G"
- elif watts >= 1e6:
- watts /= 1e6
- prefix = "M"
- elif watts >= 1e3:
- watts /= 1e3
- prefix = "K"
-
- if cicon:
- set_icon = cicon
- else:
- set_icon = s["icon"]
-
+ label = c["label"]; cicon = c["custom_icon"]; watts = c["w"]; prefix = ""
+ if watts == 0: prefix = ""
+ elif watts < 1/1e6: watts *= 1e9; prefix = "n"
+ elif watts < 1/1e3: watts *= 1e6; prefix = "µ"
+ elif watts < 1: watts *= 1e3; prefix = "m"
+ elif watts >= 1e15: watts /= 1e15; prefix = "E"
+ elif watts >= 1e12: watts /= 1e12; prefix = "T"
+ elif watts >= 1e9: watts /= 1e9; prefix = "G"
+ elif watts >= 1e6: watts /= 1e6; prefix = "M"
+ elif watts >= 1e3: watts /= 1e3; prefix = "K"
+ if cicon: set_icon = cicon
+ else: set_icon = s["icon"]
watts = round(watts, 2)
p_text = f"{label} [b]{watts} {prefix}W[/b]"
extra_entries.append({"icon": set_icon, "text": p_text, "on_release": pass_job})
@@ -696,40 +656,18 @@ class RVDetails(MDRecycleView):
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cicon = c["custom_icon"]
- watts = c["w"]
- prefix = ""
- if watts < 1/1e6:
- watts *= 1e9
- prefix = "n"
- elif watts < 1/1e3:
- watts *= 1e6
- prefix = "µ"
- elif watts < 1:
- watts *= 1e3
- prefix = "m"
- elif watts >= 1e15:
- watts /= 1e15
- prefix = "E"
- elif watts >= 1e12:
- watts /= 1e12
- prefix = "T"
- elif watts >= 1e9:
- watts /= 1e9
- prefix = "G"
- elif watts >= 1e6:
- watts /= 1e6
- prefix = "M"
- elif watts >= 1e3:
- watts /= 1e3
- prefix = "K"
-
- if cicon:
- set_icon = cicon
- else:
- set_icon = s["icon"]
-
+ label = c["label"]; cicon = c["custom_icon"]; watts = c["w"]; prefix = ""
+ if watts == 0: prefix = ""
+ elif watts < 1/1e6: watts *= 1e9; prefix = "n"
+ elif watts < 1/1e3: watts *= 1e6; prefix = "µ"
+ elif watts < 1: watts *= 1e3; prefix = "m"
+ elif watts >= 1e15: watts /= 1e15; prefix = "E"
+ elif watts >= 1e12: watts /= 1e12; prefix = "T"
+ elif watts >= 1e9: watts /= 1e9; prefix = "G"
+ elif watts >= 1e6: watts /= 1e6; prefix = "M"
+ elif watts >= 1e3: watts /= 1e3; prefix = "K"
+ if cicon: set_icon = cicon
+ else: set_icon = s["icon"]
watts = round(watts, 2)
p_text = f"{label} [b]{watts} {prefix}W[/b]"
extra_entries.append({"icon": set_icon, "text": p_text, "on_release": pass_job})
@@ -745,123 +683,83 @@ class RVDetails(MDRecycleView):
set_icon = cicon if cicon else s["icon"]
e_text = f"{label} [b]{value}[/b]"
extra_entries.append({"icon": set_icon, "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Tank":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cicon = c["custom_icon"]
- unit = c["unit"]
- cap = round(c["capacity"], 1)
- lvl = round(c["level"], 1)
- free = round(c["free"], 1)
- pct = round(c["percent"], 1)
-
+ label = c["label"]; cicon = c["custom_icon"]; unit = c["unit"]
+ cap = round(c["capacity"], 1); lvl = round(c["level"], 1)
+ free = round(c["free"], 1); pct = round(c["percent"], 1)
set_icon = cicon if cicon else s["icon"]
e_text = f"{label} level is [b]{lvl} {unit}[/b] ([b]{pct}%[/b])"
extra_entries.append({"icon": set_icon, "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Fuel":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cicon = c["custom_icon"]
- unit = c["unit"]
- cap = round(c["capacity"], 1)
- lvl = round(c["level"], 1)
- free = round(c["free"], 1)
- pct = round(c["percent"], 1)
-
+ label = c["label"]; cicon = c["custom_icon"]; unit = c["unit"]
+ cap = round(c["capacity"], 1); lvl = round(c["level"], 1)
+ free = round(c["free"], 1); pct = round(c["percent"], 1)
set_icon = cicon if cicon else s["icon"]
e_text = f"{label} level is [b]{lvl} {unit}[/b] ([b]{pct}%[/b])"
extra_entries.append({"icon": set_icon, "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Processor":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- load = c["current_load"]
- avgs = c["load_avgs"]
- clock = c["clock"]
+ label = c["label"]; load = c["current_load"]; avgs = c["load_avgs"]; clock = c["clock"]
pct = round(load*100.0, 1)
-
avgs_str = f", averages are [b]{round(avgs[0],2)}[/b], [b]{round(avgs[1],2)}[/b], [b]{round(avgs[2],2)}[/b]" if avgs != None and len(avgs) == 3 else ""
clock_str = " at [b]"+RNS.prettyfrequency(clock)+"[/b]" if clock != None else ""
-
e_text = f"Using [b]{pct}%[/b] of {label}{clock_str}{avgs_str}"
e_text = f"{label} use is [b]{pct}%[/b]{clock_str}{avgs_str}"
extra_entries.append({"icon": s["icon"], "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Non-Volatile Memory":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cap = RNS.prettysize(c["capacity"])
- use = RNS.prettysize(c["used"])
- free = RNS.prettysize(c["free"])
- pct = round(c["percent"], 1)
-
+ label = c["label"]; cap = RNS.prettysize(c["capacity"]); use = RNS.prettysize(c["used"])
+ free = RNS.prettysize(c["free"]); pct = round(c["percent"], 1)
e_text = f"{label} use is [b]{use}[/b] ([b]{pct}%[/b]) of [b]{cap}[/b], with [b]{free}[/b] free"
extra_entries.append({"icon": s["icon"], "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Random Access Memory":
cs = s["values"]
if cs != None:
for c in cs:
- label = c["label"]
- cap = RNS.prettysize(c["capacity"])
- use = RNS.prettysize(c["used"])
- free = RNS.prettysize(c["free"])
- pct = round(c["percent"], 1)
-
+ label = c["label"]; cap = RNS.prettysize(c["capacity"]); use = RNS.prettysize(c["used"])
+ free = RNS.prettysize(c["free"]); pct = round(c["percent"], 1)
e_text = f"{label} use is [b]{use}[/b] ([b]{pct}%[/b]) of [b]{cap}[/b], with [b]{free}[/b] free"
extra_entries.append({"icon": s["icon"], "text": e_text, "on_release": pass_job})
-
release_function = pass_job
elif name == "Location":
- lat = s["values"]["latitude"]
- lon = s["values"]["longitude"]
- alt = s["values"]["altitude"]
- speed = s["values"]["speed"]
- heading = s["values"]["heading"]
- accuracy = s["values"]["accuracy"]
- updated = s["values"]["updated"]
- updated_str = f", logged [b]{RNS.prettytime(time.time()-updated, compact=True)} ago[/b]"
-
- coords = f"{lat}, {lon}"
- fcoords = f"{round(lat,4)}, {round(lon,4)}"
+ lat = s["values"]["latitude"]; lon = s["values"]["longitude"]; alt = s["values"]["altitude"]
+ speed = s["values"]["speed"]; heading = s["values"]["heading"]; accuracy = s["values"]["accuracy"]
+ updated = s["values"]["updated"]; updated_str = f", logged [b]{RNS.prettytime(time.time()-updated, compact=True)} ago[/b]"
+
+ coords = f"{lat}, {lon}"; fcoords = f"{round(lat,4)}, {round(lon,4)}"
self.delegate.coords = coords
- if alt == 0:
- alt_str = "0"
- else:
- alt_str = RNS.prettydistance(alt)
+ if alt == 0: alt_str = "0"
+ else: alt_str = RNS.prettydistance(alt)
formatted_values = f"Coordinates [b]{fcoords}[/b], altitude [b]{alt_str}[/b]"
if speed != None:
if speed > 0.1: speed_formatted_values = f"Speed [b]{speed} Km/h[/b], heading [b]{heading}°[/b]"
else: speed_formatted_values = f"Object is [b]stationary[/b]"
else: speed_formatted_values = None
extra_formatted_values = f"Uncertainty [b]{accuracy} meters[/b]"+updated_str
-
data = {"icon": s["icon"], "text": f"{formatted_values}"}
-
if not self.delegate.viewing_interface: extra_entries.append({"icon": "map-marker-question", "text": extra_formatted_values, "on_release": pass_job})
- if speed_formatted_values != None:
- extra_entries.append({"icon": "speedometer", "text": speed_formatted_values, "on_release": pass_job})
+ if speed_formatted_values != None: extra_entries.append({"icon": "speedometer", "text": speed_formatted_values, "on_release": pass_job})
if "distance" in s:
if "orthodromic" in s["distance"]:
@@ -890,10 +788,8 @@ class RVDetails(MDRecycleView):
if "angle_to_horizon" in s["values"]:
oath = s["values"]["angle_to_horizon"]
if oath != None:
- if self.delegate.viewing_self:
- oath_text = f"Local horizon is at [b]{round(oath,3)}°[/b]"
- else:
- oath_text = f"Object's horizon is at [b]{round(oath,3)}°[/b]"
+ if self.delegate.viewing_self: oath_text = f"Local horizon is at [b]{round(oath,3)}°[/b]"
+ else: oath_text = f"Object's horizon is at [b]{round(oath,3)}°[/b]"
extra_entries.append({"icon": "arrow-split-horizontal", "text": oath_text, "on_release": pass_job})
if self.delegate.viewing_self and "radio_horizon" in s["values"]:
@@ -952,7 +848,6 @@ class RVDetails(MDRecycleView):
geo_uri = f"geo:{lat},{lon}"
def lj(): webbrowser.open(geo_uri)
threading.Thread(target=lj, daemon=True).start()
-
release_function = select
elif name == "Reticulum Transport":
@@ -968,7 +863,7 @@ class RVDetails(MDRecycleView):
formatted_values = f"Reticulum Transport [b]{te}[/b] with [b]{ifc}[/b] interface{'s' if ifc != 1 else ''}"
extra_entries.append({"icon": "routes", "text": f"[b]{pthc}[/b] destination{'s' if pthc != 1 else ''} reachable, [b]{lnkc}[/b] active link{'s' if lnkc != 1 else ''}", "on_release": pass_job})
- if upt: extra_entries.append({"icon": "clock-digital", "text": f"Up for [b]{RNS.prettytime(upt, compact=True)}[/b]{mem_str}"})
+ if upt: extra_entries.append({"icon": "clock-digital", "text": f"Transport up for [b]{RNS.prettytime(upt, compact=True)}[/b]{mem_str}"})
extra_entries.append({"icon": "speedometer", "text": f"Throughput [b]{RNS.prettyspeed(rxs)}[/b] in, [b]{RNS.prettyspeed(txs)}[/b] out", "on_release": pass_job})
extra_entries.append({"icon": "cube-send", "text": f"Traffic [b]{RNS.prettysize(rxb)}[/b] in, [b]{RNS.prettysize(txb)}[/b] out", "on_release": pass_job})
@@ -976,8 +871,7 @@ class RVDetails(MDRecycleView):
mc = 0; pc = 0
if "maps" in s["values"]:
for mn in s["values"]["maps"]:
- mc += 1
- pc += len(s["values"]["maps"][mn]["points"])
+ mc += 1; pc += len(s["values"]["maps"][mn]["points"])
ms = "s" if mc != 1 else ""; ps = "s" if pc != 1 else ""
formatted_values = f"[b]{mc}[/b] connection map{ms}, [b]{pc}[/b] point{ps}"


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────